import java.net.Socket;

public class UnchecckedExceptionhandler implements Thread.UncaughtExceptionHandler {
    private Socket socket;
    public UnchecckedExceptionhandler(Socket socket){
        this.socket=socket;
    }
    //捕获线程抛出的异常
    @Override
    public void uncaughtException(Thread t, Throwable e) {
        System.out.println("IP: "+socket.getInetAddress().getHostAddress()+" disconnect!");
    }
}
